package com.isd.facturacion.modelo;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import com.isd.global.modelo.CodigoPostal;
import com.isd.global.modelo.CondicionDeIva;
import com.isd.global.modelo.Jurisdiccion;
import com.isd.global.modelo.Moneda;
import com.isd.global.modelo.Pais;
import com.isd.global.modelo.Sitio;
import com.isd.global.modelo.Sucursal;
import com.isd.global.modelo.Transporte;
import com.isd.inventario.modelo.Deposito;
import com.isd.inventario.modelo.ListaDePrecio;
import com.isd.inventario.modelo.Sector;
import com.isd.venta.modelo.Cliente;
import com.isd.venta.modelo.CondicionDePago;
import com.isd.venta.modelo.Vendedor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author ctrosch
 */
@Entity
@Table(name = "TVRMVH",  schema = "dbo")
public class MovimientoTienda implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected MovimientoTiendaPK id;
    @Basic(optional = false)
    //Circuito a generar
    @Column(name = "FCRMVH_CIRCOM", nullable = false, length = 6)
    private String circom;
    @Basic(optional = false)
    //Circuito al que aplica o del que parte
    @Column(name = "FCRMVH_CIRAPL", nullable = false, length = 6)
    private String cirapl;

//    //Comprobante de Facturacion
//    @JoinColumns({
//        @JoinColumn(name = "FCRMVH_MODFOR", referencedColumnName = "GRCCBH_MODCOM", insertable=false, updatable=false),
//        @JoinColumn(name = "FCRMVH_CODFOR", referencedColumnName = "GRCCBH_CODCOM", insertable=false, updatable=false)
//    })
//    @ManyToOne
//    private Comprobante comprobante;

    //Sucursal o punto de venta
    @JoinColumn(name = "FCRMVH_SUCURS", referencedColumnName = "GRTSUC_SUCURS", nullable = false)
    @ManyToOne
    private Sucursal sucursal;

    //Fecha de movimiento
    @Basic(optional = false)
    @Column(name = "FCRMVH_FCHMOV", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date fchmov;

    //Cliente
    @JoinColumn(name = "FCRMVH_NROCTA", referencedColumnName = "VTMCLH_NROCTA", nullable = false)
    @ManyToOne(optional = false)
    private Cliente cliente;

    //Nro de subcuenta
    @Column(name = "FCRMVH_NROSUB", length = 13)
    private String nrosub;

    //Vendedor
    @JoinColumn(name = "FCRMVH_VNDDOR", referencedColumnName = "VTTVND_VNDDOR", nullable = false)
    @ManyToOne(optional=false)
    private Vendedor vendedor;

    //Condicion de pago
    @JoinColumn(name = "FCRMVH_CNDPAG", referencedColumnName = "VTTCPH_CNDPAG", nullable = false)
    @ManyToOne(optional=false)
    private CondicionDePago condicionDePago;

    //Deposito
    @JoinColumn(name = "FCRMVH_DEPOSI", referencedColumnName = "STTDEH_DEPOSI", nullable = true)
    @ManyToOne(optional=false)
    private Deposito deposito;

    //Sector
    @JoinColumns({
        @JoinColumn(name = "FCRMVH_DEPOSI", referencedColumnName = "STTDEI_DEPOSI", nullable = false, insertable=false, updatable=false),
        @JoinColumn(name = "FCRMVH_SECTOR", referencedColumnName = "STTDEI_SECTOR", nullable = false)
    })
    @ManyToOne
    private Sector sector;

    //Lista de precio
    @JoinColumn(name = "FCRMVH_CODLIS", referencedColumnName = "STTLPR_CODLIS", nullable = false)
    @ManyToOne(optional=false)
    private ListaDePrecio listaDePrecio;

    //Fecha de vigencia lista de precios
    @Column(name = "FCRMVH_FECLIS")
    @Temporal(TemporalType.DATE)
    private Date feclis;

    //Congela precio
    @Column(name = "FCRMVH_CONGEL")
    private Character congel;

    //Observaciones
    @Lob
    @Column(name = "FCRMVH_TEXTOS", length = 2147483647)
    private String textos;

    //Modulo para el comprobante que genero el movimiento
    @Column(name = "FCRMVH_MODGEN", length = 2)
    private String modgen;

    //Formulario generador
    @Basic(optional = false)
    @Column(name = "FCRMVH_CODGEN", nullable = false, length = 6)
    private String codgen;

    //Numero generador
    @Basic(optional = false)
    @Column(name = "FCRMVH_NROGEN", nullable = false)
    private Integer nrogen;

    //Coeficiente de deuda
    @JoinColumn(name = "FCRMVH_COFLIS", referencedColumnName = "GRTCOF_CODCOF", nullable = false)
    @ManyToOne
    private Moneda coeficienteDeuda;

    //Coeficiente de emisiÃ³n
    @JoinColumn(name = "FCRMVH_COFFAC", referencedColumnName = "GRTCOF_CODCOF", nullable = false)
    @ManyToOne
    private Moneda coeficienteEmision;

    //Coeficiente de registraciÃ³n
    @JoinColumn(name = "FCRMVH_COFDEU", referencedColumnName = "GRTCOF_CODCOF", nullable = false)
    @ManyToOne
    private Moneda coeficienteRegistracion;

    @Column(name = "FCRMVH_CAMSEC", precision=2, scale=7)
    private BigDecimal camsec;
    
    //Circuito generador
    @Basic(optional = false)
    @Column(name = "FCRMVH_CIRGEN", nullable = false, length = 6)
    private String cirgen;

    //Jurisdiccion
    @JoinColumn(name = "FCRMVH_JURISD", referencedColumnName = "GRTJUR_JURISD", nullable = false)
    @ManyToOne(optional=false)
    private Jurisdiccion jurisdiccion;

    //Condicion de iva
    @JoinColumn(name = "FCRMVH_CNDIVA", referencedColumnName = "GRTIVA_CNDIVA", nullable = false)
    @ManyToOne
    private CondicionDeIva condicionDeIva;

    //Congela bonificacion
    @Column(name = "FCRMVH_CONBON")
    private Character conbon;

    //Estado de autorizacion
    @Column(name = "FCRMVH_ESTAUT")
    private Short estaut;

    //Usuario de autorizaicon
    @Column(name = "FCRMVH_USRAUT", length = 36)
    private String usraut;

    //Fecha de autorizacion
    @Column(name = "FCRMVH_FCHAUT")
    @Temporal(TemporalType.DATE)
    private Date fchaut;

    //Fecha para calculo de vencimiento
    @Column(name = "FCRMVH_FCHVEN")
    @Temporal(TemporalType.DATE)
    private Date fchven;

    @Column(name = "FCRMVH_CODEMP", length = 10)
    private String codemp;
    @Column(name = "FCRMVH_EMPFCR", length = 10)
    private String empfcr;
    @Column(name = "FCRMVH_EMPGEN", length = 10)
    private String empgen;
    @Column(name = "FCRMVH_EMPOCJ", length = 10)
    private String empocj;
    @Column(name = "FCRMVH_EMPOST", length = 10)
    private String empost;
    @Column(name = "FCRMVH_EMPFST", length = 10)
    private String empfst;
    @Column(name = "FCRMVH_CANANT")
    private Character canant;
    @Column(name = "FCRMVH_COMORI", length = 4)
    private String comori;
    @Column(name = "FCRMVH_CODORI", length = 20)
    private String codori;
    @Column(name = "FCRMVH_JURCTD", length = 6)
    private String jurctd;
    @Column(name = "FCRMVH_PCTDES", precision = 15, scale = 7)
    private BigDecimal pctdes;
    @Column(name = "FCRMVH_PCTFIN", precision = 15, scale = 7)
    private BigDecimal pctfin;
    @Column(name = "FCRMVH_TASAIN", precision = 15, scale = 7)
    private BigDecimal tasain;
    @Column(name = "FCRMVH_PCTBF1", precision = 15, scale = 7)
    private BigDecimal pctbf1;
    @Column(name = "FCRMVH_PCTBF2", precision = 15, scale = 7)
    private BigDecimal pctbf2;
    @Column(name = "FCRMVH_PCTBF3", precision = 15, scale = 7)
    private BigDecimal pctbf3;
    @Column(name = "FCRMVH_PCTBF4", precision = 15, scale = 7)
    private BigDecimal pctbf4;
    @Column(name = "FCRMVH_PCTBF5", precision = 15, scale = 7)
    private BigDecimal pctbf5;
    @Column(name = "FCRMVH_PCTBL1", precision = 15, scale = 7)
    private BigDecimal pctbl1;
    @Column(name = "FCRMVH_PCTBL2", precision = 15, scale = 7)
    private BigDecimal pctbl2;
    @Column(name = "FCRMVH_PCTBL3", precision = 15, scale = 7)
    private BigDecimal pctbl3;
    
    /**
    @Column(name = "FCRMVH_DIADI1")
    private Short diadi1;
    @Column(name = "FCRMVH_PCTDI1", precision = 15, scale = 7)
    private BigDecimal pctdi1;
    @Column(name = "FCRMVH_PCTDM1", precision = 15, scale = 7)
    private BigDecimal pctdm1;
    @Column(name = "FCRMVH_DIADI2")
    private Short diadi2;
    @Column(name = "FCRMVH_PCTDI2", precision = 15, scale = 7)
    private BigDecimal pctdi2;
    @Column(name = "FCRMVH_PCTDM2", precision = 15, scale = 7)
    private BigDecimal pctdm2;
    @Column(name = "FCRMVH_DIADI3")
    private Short diadi3;
    @Column(name = "FCRMVH_PCTDI3", precision = 15, scale = 7)
    private BigDecimal pctdi3;
    @Column(name = "FCRMVH_PCTDM3", precision = 15, scale = 7)
    private BigDecimal pctdm3;
    @Column(name = "FCRMVH_DIALIB", precision = 5, scale = 2)
    private BigDecimal dialib;
    @Column(name = "FCRMVH_EDVACP")
    private Character edvacp;
    @Column(name = "FCRMVH_DOCFIS", length = 6)
    private String docfis;
    @Column(name = "FCRMVH_LETFIS", length = 6)
    private String letfis;
    @Column(name = "FCRMVH_SUCFIS", length = 6)
    private String sucfis;
    @Column(name = "FCRMVH_NROFIS")
    private Integer nrofis;
    */

    @Column(name = "FCRMVH_CNDCOM", length = 6)
    private String cndcom;

    @Column(name = "FCRMVH_TIPEXP", length = 6)
    private String tipexp;

    //De baja
    @Column(name = "FCRMVH_DEBAJA")
    private Character debaja;

    //ultima operacion
    @Column(name = "FCRMVH_ULTOPR")
    private Character ultopr;

    //Fecha de alta
    @Column(name = "FCRMVH_FECALT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecalt;

    //Fecha de ultima modificacion
    @Column(name = "FCRMVH_FECMOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmod;

    //Usuario
    @Column(name = "FCRMVH_USERID")
    private String userid;

    //Oalias
    @Column(name = "FCRMVH_OALIAS")
    private String oalias;

    //Proceso total
    @Column(name = "FCRMVH_ISPRCT")
    private Character isprct;

    //Sitio
    @JoinColumn(name = "USR_FCRMVH_SITIOS", referencedColumnName = "USR_SITIOS_CODIGO", nullable = false, insertable=true, updatable=true)
    @ManyToOne
    private Sitio sitio;

    //Flete cargo intercap
    @Column(name = "USR_FCRMVH_FLCINP")
    private Character flcinp;
    //Porcentaje flete cargo intercap
    @Column(name = "USR_FCRMVH_FLCPOR", precision = 15, scale = 7)
    private BigDecimal flcpor;

    //Datos de entrega
    //CÃ³digo de entrega
    @Column(name = "FCRMVH_CDENT1", length = 6)
    private String cdent1;

    //Transportista
    @JoinColumn(name = "FCRMVH_TRACOD", referencedColumnName = "GRTTRA_TRACOD", nullable = false)
    @ManyToOne
    private Transporte transporte;

    //Direccion de entrega
    @Column(name = "FCRMVH_DIRENT", length = 60)
    private String dirent;

    //Pais de entrega
    @JoinColumn(name = "FCRMVH_PAIENT", referencedColumnName = "GRTPAH_CODPAI", nullable = false)
    @ManyToOne
    private Pais pais;

    //Codigo postal entrega
    @JoinColumns({
        @JoinColumn(name = "FCRMVH_CODENT", referencedColumnName = "GRTPAC_CODPOS", nullable = false),
        @JoinColumn(name = "FCRMVH_PAIENT", referencedColumnName = "GRTPAC_CODPAI", nullable = false, insertable=false, updatable=false)
    })
    @ManyToOne
    private CodigoPostal codigoPostalEntrega;

    //DescripciÃ³n de transportista
    @Column(name = "FCRMVH_TRANSP", length = 60)
    private String transp;

    //Tipo documento transporte
    @Column(name = "FCRMVH_TIPDOC", length = 4)
    private String tipdoc;

    //Numero de documento transporte
    @Column(name = "FCRMVH_TRCUIT", length = 50)
    private String trcuit;

    //Direccion transporte
    @Column(name = "FCRMVH_TRANDR", length = 60)
    private String trandr;

    //Codigo de zona
    @Column(name = "FCRMVH_CODZON", length = 6)
    private String codzon;

    //Nro de cuenta de entrega
    @Column(name = "FCRMVH_CTAEN1", length = 13)
    private String ctaen1;

    //Nro de pool
    @Column(name = "USR_FCRMVH_NRPOOL")
    private Integer nroPool;

    @Column(name = "USR_FCRMVH_FCHSCR")
    @Temporal(TemporalType.DATE)
    private Date fechaUltimoScore;

    @Column(name = "USR_FCRMVH_VALSCR")
    private Integer valorUltimoScore;
    
    @Column(name = "USR_FCRMVH_PIB902", length=1)
    private BigDecimal pib902;
        
    @Column(name = "USR_FCRMVH_PIB903", length=1)
    private BigDecimal pib903;
        
    @Column(name = "USR_FCRMVH_PIB909", length=1)
    private BigDecimal pib909;
        
    @Column(name = "USR_FCRMVH_PIB914", length=1)
    private BigDecimal pib914;
    
    @Column(name = "USR_FCRMVH_PIB918", length=1)
    private BigDecimal pib918;
        
    @Column(name = "USR_FCRMVH_PIB921", length=1)
    private BigDecimal pib921;
    
    @Column(name = "USR_FCRMVH_PIB924", length=1)
    private BigDecimal pib924;
    
    @OneToMany(mappedBy = "movimiento", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
    private List<ItemProductoTienda> itemsProducto;

    @OneToMany(mappedBy = "movimiento", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
    private List<ItemAplicacionTienda> itemsAplicacion;
    
    @OneToMany(mappedBy = "movimiento", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
    private List<ItemComponenteTienda> itemsComponente;

    @Transient
    private BigDecimal subTotalConIVA;

    @Transient
    private BigDecimal subTotalPendienteConIVA;

    @Transient
    private int cantidadItems;

    public MovimientoTienda() {

        conbon = 'S';
        isprct = 'N';
        codemp = "TEM";
        empgen = "TEM";
        empfst = "TEM";
        pctdes = BigDecimal.ZERO;
        pctfin = BigDecimal.ZERO;
        tasain = BigDecimal.ZERO;
        pctbf1 = BigDecimal.ZERO;
        pctbf2 = BigDecimal.ZERO;
        pctbf3 = BigDecimal.ZERO;
        pctbf4 = BigDecimal.ZERO;
        pctbf5 = BigDecimal.ZERO;
        pctbl1 = BigDecimal.ZERO;
        pctbl2 = BigDecimal.ZERO;
        pctbl3 = BigDecimal.ZERO;
        fecalt = new Date();
        fecmod = new Date();
        ultopr = 'A';
        debaja = 'N';
        userid = "ADMIN";
        oalias = "FCRMVH";
    }

    public MovimientoTienda(MovimientoTiendaPK movimientoVentaPK) {
        this.id = movimientoVentaPK;
        conbon = 'S';
        isprct = 'N';
        codemp = "TEM";
        empgen = "TEM";
        empfst = "TEM";
        pctdes = BigDecimal.ZERO;
        pctfin = BigDecimal.ZERO;
        tasain = BigDecimal.ZERO;
        pctbf1 = BigDecimal.ZERO;
        pctbf2 = BigDecimal.ZERO;
        pctbf3 = BigDecimal.ZERO;
        pctbf4 = BigDecimal.ZERO;
        pctbf5 = BigDecimal.ZERO;
        pctbl1 = BigDecimal.ZERO;
        pctbl2 = BigDecimal.ZERO;
        pctbl3 = BigDecimal.ZERO;
        fecalt = new Date();
        fecmod = new Date();
        ultopr = 'A';
        debaja = 'N';
        userid = "ADMIN";
        oalias = "FCRMVH";

    }

    public MovimientoTienda(MovimientoTiendaPK movimientoVentaPK, String circom, String cirapl, Date fchmov, Cliente cliente,
            Vendedor vendedor, CondicionDePago condicionDePago, ListaDePrecio listaDePrecio, String codgen, String cirgen,
            int fcrmvhNrogen, Jurisdiccion jurisdiccion) {

        this.id = movimientoVentaPK;
        this.circom = circom;
        this.cirapl = cirapl;
        this.fchmov = fchmov;
        this.cliente = cliente;
        this.vendedor = vendedor;
        this.condicionDePago = condicionDePago;
        this.listaDePrecio = listaDePrecio;
        this.codgen = codgen;
        this.cirgen = cirgen;
        this.jurisdiccion = jurisdiccion;
        conbon = 'S';

        isprct = 'N';
        codemp = "TEM";
        empgen = "TEM";
        empfst = "TEM";
        pctdes = BigDecimal.ZERO;
        pctfin = BigDecimal.ZERO;
        tasain = BigDecimal.ZERO;
        pctbf1 = BigDecimal.ZERO;
        pctbf2 = BigDecimal.ZERO;
        pctbf3 = BigDecimal.ZERO;
        pctbf4 = BigDecimal.ZERO;
        pctbf5 = BigDecimal.ZERO;
        pctbl1 = BigDecimal.ZERO;
        pctbl2 = BigDecimal.ZERO;
        pctbl3 = BigDecimal.ZERO;
        fecalt = new Date();
        fecmod = new Date();
        ultopr = 'A';
        debaja = 'N';
        userid = "ADMIN";
        oalias = "FCRMVH";
        
        pib902 = cliente.getPib902();
        pib903 = cliente.getPib903();
        pib909 = cliente.getPib909();
        pib914 = cliente.getPib914();
        pib918 = cliente.getPib918();
        pib921 = cliente.getPib921();
        pib924 = cliente.getPib924();
                
    }

    public MovimientoTienda(String modcom, String codcom, int fcrmvhNrofor) {
        this.id = new MovimientoTiendaPK(modcom,codcom,fcrmvhNrofor);
        conbon = 'S';
        isprct = 'N';
        codemp = "TEM";
        empgen = "TEM";
        empfst = "TEM";
        pctdes = BigDecimal.ZERO;
        pctfin = BigDecimal.ZERO;
        tasain = BigDecimal.ZERO;
        pctbf1 = BigDecimal.ZERO;
        pctbf2 = BigDecimal.ZERO;
        pctbf3 = BigDecimal.ZERO;
        pctbf4 = BigDecimal.ZERO;
        pctbf5 = BigDecimal.ZERO;
        pctbl1 = BigDecimal.ZERO;
        pctbl2 = BigDecimal.ZERO;
        pctbl3 = BigDecimal.ZERO;
        fecalt = new Date();
        fecmod = new Date();
        ultopr = 'A';
        debaja = 'N';
        userid = "ADMIN";
        oalias = "FCRMVH";
    }

    public MovimientoTiendaPK getId() {
        return id;
    }

    public void setId(MovimientoTiendaPK movimientoVentaPK) {
        this.id = movimientoVentaPK;
    }

    public String getCirapl() {
        return cirapl;
    }

    public void setCirapl(String cirapl) {
        this.cirapl = cirapl;
    }

    public String getCircom() {
        return circom;
    }

    public void setCircom(String circom) {
        this.circom = circom;
    }

    public String getCirgen() {
        return cirgen;
    }

    public void setCirgen(String cirgen) {
        this.cirgen = cirgen;
    }

    public Cliente getCliente() {
        return cliente;
    }

    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
        if(cliente!=null){
            nrosub = cliente.getNrocta();
        }
    }


    public String getCodgen() {
        return codgen;
    }

    public void setCodgen(String codgen) {
        this.codgen = codgen;
    }

    public Moneda getCoeficienteDeuda() {
        return coeficienteDeuda;
    }

    public void setCoeficienteDeuda(Moneda coeficienteDeuda) {
        this.coeficienteDeuda = coeficienteDeuda;
    }

    public Moneda getCoeficienteEmision() {
        return coeficienteEmision;
    }

    public void setCoeficienteEmision(Moneda coeficienteEmision) {
        this.coeficienteEmision = coeficienteEmision;
    }

    public Moneda getCoeficienteRegistracion() {
        return coeficienteRegistracion;
    }

    public void setCoeficienteRegistracion(Moneda coeficienteRegistracion) {
        this.coeficienteRegistracion = coeficienteRegistracion;
    }

    public Character getConbon() {
        return conbon;
    }

    public void setConbon(Character conbon) {
        this.conbon = conbon;
    }

    public CondicionDeIva getCondicionDeIva() {
        return condicionDeIva;
    }

    public void setCondicionDeIva(CondicionDeIva condicionDeIva) {
        this.condicionDeIva = condicionDeIva;
    }

    public CondicionDePago getCondicionDePago() {
        return condicionDePago;
    }

    public void setCondicionDePago(CondicionDePago condicionDePago) {
        this.condicionDePago = condicionDePago;
    }

    public Character getCongel() {
        return congel;
    }

    public void setCongel(Character congel) {
        this.congel = congel;
    }

    public Character getDebaja() {
        return debaja;
    }

    public void setDebaja(Character debaja) {
        this.debaja = debaja;
    }

    public Deposito getDeposito() {
        return deposito;
    }

    public void setDeposito(Deposito deposito) {
        this.deposito = deposito;
    }

    public Short getEstaut() {
        return estaut;
    }

    public void setEstaut(Short estaut) {
        this.estaut = estaut;
    }

    public Date getFchaut() {
        return fchaut;
    }

    public void setFchaut(Date fchaut) {
        this.fchaut = fchaut;
    }

    public Date getFchmov() {
        return fchmov;
    }

    public void setFchmov(Date fchmov) {
        this.fchmov = fchmov;
    }

    public Date getFchven() {
        return fchven;
    }

    public void setFchven(Date fchven) {
        this.fchven = fchven;
    }

    public Character getCanant() {
        return canant;
    }

    public void setCanant(Character canant) {
        this.canant = canant;
    }


    public String getCndcom() {
        return cndcom;
    }

    public void setCndcom(String cndcom) {
        this.cndcom = cndcom;
    }

    public String getCodemp() {
        return codemp;
    }

    public void setCodemp(String codemp) {
        this.codemp = codemp;
    }

    public String getCodori() {
        return codori;
    }

    public void setCodori(String codori) {
        this.codori = codori;
    }

    public String getComori() {
        return comori;
    }

    public void setComori(String comori) {
        this.comori = comori;
    }

    public String getEmpfcr() {
        return empfcr;
    }

    public void setEmpfcr(String empfcr) {
        this.empfcr = empfcr;
    }

    public String getEmpfst() {
        return empfst;
    }

    public void setEmpfst(String empfst) {
        this.empfst = empfst;
    }

    public String getEmpgen() {
        return empgen;
    }

    public void setEmpgen(String empgen) {
        this.empgen = empgen;
    }

    public String getEmpocj() {
        return empocj;
    }

    public void setEmpocj(String empocj) {
        this.empocj = empocj;
    }

    public String getEmpost() {
        return empost;
    }

    public void setEmpost(String empost) {
        this.empost = empost;
    }

    public Character getFlcinp() {
        return flcinp;
    }

    public void setFlcinp(Character flcinp) {
        this.flcinp = flcinp;
    }

    public BigDecimal getFlcpor() {
        return flcpor;
    }

    public void setFlcpor(BigDecimal flcpor) {
        this.flcpor = flcpor;
    }

    public String getJurctd() {
        return jurctd;
    }

    public void setJurctd(String jurctd) {
        this.jurctd = jurctd;
    }

    public BigDecimal getPctbf1() {
        return pctbf1;
    }

    public void setPctbf1(BigDecimal pctbf1) {
        this.pctbf1 = pctbf1;
    }

    public BigDecimal getPctbf2() {
        return pctbf2;
    }

    public void setPctbf2(BigDecimal pctbf2) {
        this.pctbf2 = pctbf2;
    }

    public BigDecimal getPctbf3() {
        return pctbf3;
    }

    public void setPctbf3(BigDecimal pctbf3) {
        this.pctbf3 = pctbf3;
    }

    public BigDecimal getPctbf4() {
        return pctbf4;
    }

    public void setPctbf4(BigDecimal pctbf4) {
        this.pctbf4 = pctbf4;
    }

    public BigDecimal getPctbf5() {
        return pctbf5;
    }

    public void setPctbf5(BigDecimal pctbf5) {
        this.pctbf5 = pctbf5;
    }

    public BigDecimal getPctbl1() {
        return pctbl1;
    }

    public void setPctbl1(BigDecimal pctbl1) {
        this.pctbl1 = pctbl1;
    }

    public BigDecimal getPctbl2() {
        return pctbl2;
    }

    public void setPctbl2(BigDecimal pctbl2) {
        this.pctbl2 = pctbl2;
    }

    public BigDecimal getPctbl3() {
        return pctbl3;
    }

    public void setPctbl3(BigDecimal pctbl3) {
        this.pctbl3 = pctbl3;
    }
    
    public BigDecimal getPctdes() {
        return pctdes;
    }

    public void setPctdes(BigDecimal pctdes) {
        this.pctdes = pctdes;
    }

    public BigDecimal getPctfin() {
        return pctfin;
    }

    public void setPctfin(BigDecimal pctfin) {
        this.pctfin = pctfin;
    }

    public BigDecimal getTasain() {
        return tasain;
    }

    public void setTasain(BigDecimal tasain) {
        this.tasain = tasain;
    }

    public String getTipexp() {
        return tipexp;
    }

    public void setTipexp(String tipexp) {
        this.tipexp = tipexp;
    }

    public Date getFeclis() {
        return feclis;
    }

    public void setFeclis(Date feclis) {
        this.feclis = feclis;
    }

    public Jurisdiccion getJurisdiccion() {
        return jurisdiccion;
    }

    public void setJurisdiccion(Jurisdiccion jurisdiccion) {
        this.jurisdiccion = jurisdiccion;
    }

    public ListaDePrecio getListaDePrecio() {
        return listaDePrecio;
    }

    public void setListaDePrecio(ListaDePrecio listaDePrecio) {
        this.listaDePrecio = listaDePrecio;
    }

    public String getModgen() {
        return modgen;
    }

    public void setModgen(String modgen) {
        this.modgen = modgen;
    }

    public String getNrosub() {
        return nrosub;
    }

    public void setNrosub(String nrosub) {
        this.nrosub = nrosub;
    }

    public Sector getSector() {
        return sector;
    }

    public void setSector(Sector sector) {
        this.sector = sector;
    }

    public Sitio getSitio() {
        return sitio;
    }

    public void setSitio(Sitio sitio) {
        this.sitio = sitio;
    }

    public Sucursal getSucursal() {
        return sucursal;
    }

    public void setSucursal(Sucursal sucursal) {
        this.sucursal = sucursal;
    }

    public String getTextos() {
        return textos;
    }

    public void setTextos(String textos) {
        this.textos = textos;
    }


    public Date getFecalt() {
        return fecalt;
    }

    public void setFecalt(Date fecalt) {
        this.fecalt = fecalt;
    }

    public Date getFecmod() {
        return fecmod;
    }

    public void setFecmod(Date fecmod) {
        this.fecmod = fecmod;
    }

    public Character getUltopr() {
        return ultopr;
    }

    public void setUltopr(Character ultopr) {
        this.ultopr = ultopr;
    }


    public String getUsraut() {
        return usraut;
    }

    public void setUsraut(String usraut) {
        this.usraut = usraut;
    }

    public Vendedor getVendedor() {
        return vendedor;
    }

    public void setVendedor(Vendedor vendedor) {
        this.vendedor = vendedor;
    }

    public Integer getNrogen() {
        return nrogen;
    }

    public void setNrogen(Integer nrogen) {
        this.nrogen = nrogen;
    }

    public BigDecimal getCamsec() {
        return camsec;
    }

    public void setCamsec(BigDecimal camsec) {
        this.camsec = camsec;
    }

    public Character getIsprct() {
        return isprct;
    }

    public void setIsprct(Character isprct) {
        this.isprct = isprct;
    }

    public String getOalias() {
        return oalias;
    }

    public void setOalias(String oalias) {
        this.oalias = oalias;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getCdent1() {
        return cdent1;
    }

    public void setCdent1(String cdent1) {
        this.cdent1 = cdent1;
    }

    public CodigoPostal getCodigoPostalEntrega() {
        return codigoPostalEntrega;
    }

    public void setCodigoPostalEntrega(CodigoPostal codigoPostalEntrega) {
        this.codigoPostalEntrega = codigoPostalEntrega;
    }

    public String getCodzon() {
        return codzon;
    }

    public void setCodzon(String codzon) {
        this.codzon = codzon;
    }

    public String getCtaen1() {
        return ctaen1;
    }

    public void setCtaen1(String ctaen1) {
        this.ctaen1 = ctaen1;
    }

    public String getDirent() {
        return dirent;
    }

    public void setDirent(String dirent) {
        this.dirent = dirent;
    }

    public Pais getPais() {
        return pais;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public String getTipdoc() {
        return tipdoc;
    }

    public void setTipdoc(String tipdoc) {
        this.tipdoc = tipdoc;
    }

    public String getTrandr() {
        return trandr;
    }

    public void setTrandr(String trandr) {
        this.trandr = trandr;
    }

    public String getTransp() {
        return transp;
    }

    public void setTransp(String transp) {
        this.transp = transp;
    }

    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;

        if(transporte!=null){
            transp = transporte.getDescrp();
            trcuit = transporte.getNrodoc();
            tipdoc = transporte.getTipoDocumento().getTipdoc();
            trandr = transporte.getTradir();
        }
    }

    public String getTrcuit() {
        return trcuit;
    }

    public void setTrcuit(String trcuit) {
        this.trcuit = trcuit;
    }

    public List<ItemAplicacionTienda> getItemsAplicacion() {
        return itemsAplicacion;
    }

    public void setItemsAplicacion(List<ItemAplicacionTienda> itemsAplicacion) {
        this.itemsAplicacion = itemsAplicacion;
    }

    public List<ItemProductoTienda> getItemsProducto() {
        return itemsProducto;
    }

    public void setItemsProducto(List<ItemProductoTienda> itemsProducto) {
        this.itemsProducto = itemsProducto;
    }

    public BigDecimal getSubTotalConIVA() {

        subTotalConIVA = BigDecimal.ZERO;

        if(itemsProducto!=null){
            for(ItemProductoTienda i: itemsProducto){
            subTotalConIVA = subTotalConIVA.add(i.getTotalLineaConIVA());
            }
        }
        return subTotalConIVA;
    }

    public void setSubTotalConIVA(BigDecimal importeTotalConIVA) {
        this.subTotalConIVA = importeTotalConIVA;
    }

    public BigDecimal getSubTotalPendienteConIVA() {

        subTotalPendienteConIVA = BigDecimal.ZERO;

        if(itemsProducto!=null){
            for(ItemProductoTienda i: itemsProducto){
                subTotalPendienteConIVA = subTotalPendienteConIVA.add(i.getTotalPendienteConIVA());
            }
        }
        return subTotalPendienteConIVA;
    }

    public void setSubTotalPendienteConIVA(BigDecimal importePendienteConIVA) {
        this.subTotalPendienteConIVA = importePendienteConIVA;
    }

    public int getCantidadItems() {
        if(itemsProducto==null) return 0;
        return getItemsProducto().size();
    }

    public void setCantidadItems(int cantidadItems) {
        this.cantidadItems = cantidadItems;
    }

    public Integer getNroPool() {
        return nroPool;
    }

    public void setNroPool(Integer nroPool) {
        this.nroPool = nroPool;
    }

    public Date getFechaUltimoScore() {
        return fechaUltimoScore;
    }

    public void setFechaUltimoScore(Date fechaUltimoScore) {
        this.fechaUltimoScore = fechaUltimoScore;
    }

    public Integer getValorUltimoScore() {
        return valorUltimoScore;
    }

    public void setValorUltimoScore(Integer valorUltimoScore) {
        this.valorUltimoScore = valorUltimoScore;
    }

    public List<ItemComponenteTienda> getItemsComponente() {
        return itemsComponente;
    }

    public void setItemsComponente(List<ItemComponenteTienda> itemsComponente) {
        this.itemsComponente = itemsComponente;
    }

    public BigDecimal getPib902() {
        return pib902;
    }

    public void setPib902(BigDecimal pib902) {
        this.pib902 = pib902;
    }

    public BigDecimal getPib903() {
        return pib903;
    }

    public void setPib903(BigDecimal pib903) {
        this.pib903 = pib903;
    }

    public BigDecimal getPib909() {
        return pib909;
    }

    public void setPib909(BigDecimal pib909) {
        this.pib909 = pib909;
    }

    public BigDecimal getPib914() {
        return pib914;
    }

    public void setPib914(BigDecimal pib914) {
        this.pib914 = pib914;
    }

    public BigDecimal getPib918() {
        return pib918;
    }

    public void setPib918(BigDecimal pib918) {
        this.pib918 = pib918;
    }

    public BigDecimal getPib921() {
        return pib921;
    }

    public void setPib921(BigDecimal pib921) {
        this.pib921 = pib921;
    }

    public BigDecimal getPib924() {
        return pib924;
    }

    public void setPib924(BigDecimal pib924) {
        this.pib924 = pib924;
    }
       
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MovimientoTienda)) {
            return false;
        }
        MovimientoTienda other = (MovimientoTienda) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tv.venta.modelo.MovimientoVenta[movimientoVentaPK=" + id + "]";
    }


}
